-
Notifications
You must be signed in to change notification settings - Fork 46
Feat/refacto block data module #2449
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: arith-dev
Are you sure you want to change the base?
Conversation
| .arg1Lo(arg1B32.hi()) | ||
| .arg2Hi(arg2B32.lo()) | ||
| .arg2Lo(arg2B32.hi()) | ||
| .res(booleanToBytes(wcp.callLT(arg1B32, arg2B32))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug: Comparison Methods Return Incorrect Values
The callToGT method calls wcp.callLT instead of wcp.callGT, and callToGEQ calls wcp.callLEQ instead of wcp.callGEQ. This copy-paste error results in both methods returning the opposite boolean value for their intended comparisons.
Additional Locations (1)
| .arg1Lo(arg1B32.hi()) | ||
| .arg2Hi(arg2B32.lo()) | ||
| .arg2Lo(arg2B32.hi()) | ||
| .res(booleanToBytes(wcp.callLEQ(arg1B32, arg2B32))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| exoCalls[0] = BlockDataExoCall.callToLT(this.wcp, data, POWER_256_8); | ||
|
|
||
| // row i + 1 | ||
| exoCalls[1] = BlockDataExoCall.callToLT(this.wcp, data, prevData); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug: Timestamp Validation Fails for Decreasing Block Times
The TimestampInstruction incorrectly validates block timestamps. It uses callToLT to compare the current timestamp with the previous one. Blockchain timestamps must be strictly increasing, so this allows blocks with decreasing timestamps to be incorrectly validated.
|
|
||
| // row i + 1 | ||
| // comparison to maximum | ||
| exoCalls[1] = BlockDataExoCall.callToGEQ(this.wcp, data, gasLimitMaximum); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
|
||
| /** Store all wcp and euc computations with params and results */ | ||
| // TODO ctMax vs nbRows | ||
| public final BlockDataExoCall[] exoCalls = new BlockDataExoCall[nbRows()]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug: Abstract Method Called Before Subclass Initialization
The exoCalls array is initialized in the BlockDataInstruction constructor by calling the abstract nbRows() method. This means nbRows() executes before any concrete subclass constructor, potentially leading to runtime errors if the subclass implementation relies on uninitialized state.
Note
Refactors BlockData to an instruction-based design per opcode, introduces BlockDataExoCall for WCP/EUC interactions, updates fork modules, and removes legacy operation classes.
BlockdataOperationlist withMap<Long, List<BlockDataInstruction>> blockInstructionsand iterate per-instruction incommit.firstBlockNumber,blockNumber,blockTimestamp; computelineCountfromblockInstructions.getInstruction(...)to build opcode-specific instructions.CoinbaseInstruction,TimestampInstruction,NumberInstruction,DifficultyInstruction,PrevRandaoInstruction,GasLimitInstruction,ChainIdInstruction,BaseFeeInstruction,BlobBaseFeeInstructionwithhandle/nbRows/traceInstructionand exo-call setups.BlockDataInstructionhandling tracing and per-row fields.BlockDataExoCallto encapsulate WCP/EUC calls and results (callToLT/GT/LEQ/GEQ/IsZero/EUC).LondonBlockData,ParisBlockData,ShanghaiBlockData,CancunBlockDataupdated to define opcode sets and implement tracing hooks (timestamp/number or relTxNumMax as applicable).moduleOperationclasses (BlockdataOperationand fork-specific subclasses).Written by Cursor Bugbot for commit bd1bc31. This will update automatically on new commits. Configure here.